package chances.system.operator.repo;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import chances.system.operator.entity.Oplog;

public interface OplogRepository extends JpaRepository<Oplog, Long> {
    @Query("select o from Oplog o where o.operateType = :operateType order by o.operateTime desc")
    Page<Oplog> findOplogsByOperateType(@Param("operateType") String operateType,
            Pageable pageable);

    @Query("select o from Oplog o")
    public Page<Oplog> searchLogs(@Param("name") String name, @Param("orgName") String orgName,
            @Param("opName") String opName, @Param("beginTime") String beginTime,
            @Param("endTime") String endTime, Pageable pageable);
}
